#include "SearcherServer.h"

void test0(){
    shared_ptr<Configuration> conf = shared_ptr<Configuration>(new Configuration("../conf/myconf.json"));
    SplitTool *cuttor = SplitToolCppJieba::getInstance();
    //用于关键字推荐
    shared_ptr<Dictionary> pDict = 
        shared_ptr<Dictionary>(new Dictionary("../data/dict.dat","../data/dictIndex.dat"));
    KeyRecommander keyRecommander(pDict);
    //用于网页搜索
    shared_ptr<WebPageQuery> pQuery = 
        shared_ptr<WebPageQuery>(new WebPageQuery(cuttor,conf.get(),
                                                 "../data/cleanedPage.dat",
                                                 "../data/noDupIndex.dat",
                                                 "../data/invertIndex.dat"));
    WebPageSearcher webPageSearcher(pQuery);
    //用于实现缓存
    LRUCache lruCache(10);
    //创建服务器
    SearcherServer searchserver(4,10,"127.0.0.1",8888,
                                &keyRecommander,&webPageSearcher,
                                &lruCache);
    searchserver.start();
}

int main()
{
    test0();
    return 0;
}

